<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        img{display: block;}
        div img{width: 300px;height: 200px;}
        .parent{width: 300px;height: 200px;margin: 30px auto;position: relative;}
        .parent div{width: 100%;height: 100%;position: absolute;left: 0;top: 0;
            transition: 1s; backface-visibility: hidden;}

        .parent div:first-child{transform: rotateY(0);}
        .parent div:last-child{transform: rotateY(-180deg);}

        .parent:hover div:first-child{transform: rotateY(180deg);}
        .parent:hover div:last-child{transform: rotateY(0);}
    </style>
</head>
<body>
    <div class="parent">
        <div>
            <img src="./img/2.jpg" alt="">
        </div>
        <div>
            <img src="./img/3.jpg" alt="">
        </div>
    </div>
</body>
</html>